package com.example.demo.service;

import com.example.demo.mapper.BlogMapper;
import com.example.demo.model.Blog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {
    @Autowired
    private BlogMapper blogMapper;
    public List<Blog> getBlogList() {
        return blogMapper.getAll();
    }

    //调数据库
    public Blog getBlogDetail(Integer blogId) {
        return blogMapper.selectById(blogId);
    }

    //插入
    public Integer insert(Blog blog) {
        return blogMapper.insert(blog);
    }
    //修改
    public Integer update(Blog blog){
        return blogMapper.update(blog);
    }
    //删除
    public Integer delete(Integer blogId){
        return blogMapper.delete(blogId);
    }
}
